import { createRouter, createWebHistory } from 'vue-router'

import contactUs from '@/views/contactUs/index.vue'
import home from '@/views/home/index.vue'

const routes = [
  {
    path: '/',
    name: 'home1',
    component: home,
    meta: {
      title: 'home'
    }
  },
  {
    path: '/home',
    name: 'home',
    component: home,
    meta: {
      title: 'home'
    }
  },
  {
    path: '/contactUs',
    name: 'contactUs',
    component: contactUs,
    meta: {
      title: 'contactUs'
    }
  }
]

let router = null
export const useRouter = () => {
  if (router) {
    return router
  }
  router = createRouter({
    history: createWebHistory(),
    routes
  })
  return router
}
